<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductTokensTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('product_tokens', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->bigInteger('product_id')->index()->comment('商品ID');
            $table->string('token_id', 64)->index()->comment('凭证ID');
            $table->bigInteger('order_id')->default(0)->index()->comment('订单ID');
            $table->string('status', 16)->default(\App\Enums\TokenStatus::INIT)->comment('token状态');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('product_tokens');
    }
}
